CREATE TABLE [dbo].[tb_CuentasLiquidacion]
(
[idCuentaLiquidacion] [int] NOT NULL IDENTITY(1, 1),
[Agente] [int] NOT NULL,
[TipoDeCuenta] [int] NOT NULL,
[NroDeCuenta] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[SucursalBancaria] [int] NOT NULL,
[ALaOrdenDe] [int] NOT NULL,
[Afiliacion] [int] NULL
) ON [PRIMARY]
ALTER TABLE [dbo].[tb_CuentasLiquidacion] WITH NOCHECK ADD
CONSTRAINT [FK_tb_CuentasLiquidacion_tb_Afiliaciones] FOREIGN KEY ([Afiliacion]) REFERENCES [dbo].[tb_Afiliaciones] ([idAfiliacion])
ALTER TABLE [dbo].[tb_CuentasLiquidacion] NOCHECK CONSTRAINT [FK_tb_CuentasLiquidacion_tb_Afiliaciones]
ALTER TABLE [dbo].[tb_CuentasLiquidacion] WITH NOCHECK ADD
CONSTRAINT [FK_tb_CuentasLiquidacion_tb_Agentes] FOREIGN KEY ([Agente]) REFERENCES [dbo].[tb_Agentes] ([idAgente])
ALTER TABLE [dbo].[tb_CuentasLiquidacion] NOCHECK CONSTRAINT [FK_tb_CuentasLiquidacion_tb_Agentes]
ALTER TABLE [dbo].[tb_CuentasLiquidacion] WITH NOCHECK ADD
CONSTRAINT [FK_tb_CuentasLiquidacion_tb_EntidadesDestinatariasDePago] FOREIGN KEY ([ALaOrdenDe]) REFERENCES [dbo].[tb_EntidadesDestinatariasDePago] ([idEntidad])
ALTER TABLE [dbo].[tb_CuentasLiquidacion] NOCHECK CONSTRAINT [FK_tb_CuentasLiquidacion_tb_EntidadesDestinatariasDePago]
ALTER TABLE [dbo].[tb_CuentasLiquidacion] WITH NOCHECK ADD
CONSTRAINT [FK_tb_CuentasLiquidacion_tb_SucursalesBancarias] FOREIGN KEY ([SucursalBancaria]) REFERENCES [dbo].[tb_SucursalesBancarias] ([idSucursalBancaria])
ALTER TABLE [dbo].[tb_CuentasLiquidacion] NOCHECK CONSTRAINT [FK_tb_CuentasLiquidacion_tb_SucursalesBancarias]
ALTER TABLE [dbo].[tb_CuentasLiquidacion] WITH NOCHECK ADD
CONSTRAINT [FK_tb_CuentasLiquidacion_tb_TiposDeCuentaBancaria] FOREIGN KEY ([TipoDeCuenta]) REFERENCES [dbo].[tb_TiposDeCuentaBancaria] ([idTipoCuenta])
ALTER TABLE [dbo].[tb_CuentasLiquidacion] NOCHECK CONSTRAINT [FK_tb_CuentasLiquidacion_tb_TiposDeCuentaBancaria]
GO
ALTER TABLE [dbo].[tb_CuentasLiquidacion] ADD CONSTRAINT [PK_tb_CuentasLiquidacion] PRIMARY KEY NONCLUSTERED  ([idCuentaLiquidacion]) ON [PRIMARY]
GO
